'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');

var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);

var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');

var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _slider = require('antd/lib/slider');

var _slider2 = _interopRequireDefault(_slider);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

/* eslint-disable react/prop-types */
exports['default'] = function (_ref) {
  var v = _ref.value,
      _onChange = _ref.onChange,
      props = (0, _objectWithoutProperties3['default'])(_ref, ['value', 'onChange']);

  var _useState = (0, _react.useState)(v),
      _useState2 = (0, _slicedToArray3['default'])(_useState, 2),
      value = _useState2[0],
      setValue = _useState2[1];

  (0, _react.useEffect)(function () {
    setValue(v);
  }, [v]);
  return _react2['default'].createElement(_slider2['default'], (0, _extends3['default'])({}, props, {
    value: value,
    onChange: function onChange(e) {
      setValue(e);
      _onChange('opacity', e, true);
    },
    onAfterChange: function onAfterChange(e) {
      setValue(e);
      _onChange('opacity', e);
    }
  }));
};

module.exports = exports['default'];